package com.example.swagger.swaggerUI;

import com.example.swagger.config.CodeMsg;
import com.example.swagger.config.JsonResult;
import com.example.swagger.entity.*;
import com.example.swagger.mapper.DepartmentMapper;
import com.example.swagger.service.*;
import io.swagger.annotations.*;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.text.SimpleDateFormat;
import java.util.*;
import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

@Controller

@RequestMapping(value="/users")     // 通过这里配置使下面的映射都在/users下，可去除
/**
 * 需要注意的地方：
 *
 * Controller中定义的方法必须在@RequestMapper中显示的指定RequestMethod类型，
 * 否则SawggerUi会默认为全类型皆可访问， API列表中会生成多条项目
 */
public class SwaggerUIConfigController {

    @Autowired
    private BookService bookService;
    @Autowired
    private UserService userService;
    @Autowired
    private t_userHandleService t_userService;
    @Autowired
    private AdminService adminService;
    @Autowired
    private OrderService orderService;
    @Autowired
    private DepartmentService departmentService;
    @Autowired
    private EmployeeService employeeService;

    static Map<Long, User> users = Collections.synchronizedMap(new HashMap<Long, User>());

    @ApiOperation(value = "用户信息反馈", tags = {"用户模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "userId", dataType = "String", required = true, value = "用户 Id")
    })
    @ApiResponses({
            @ApiResponse(code = 400, message = "请求参数没填好"),
            @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")
    })
    @RequestMapping(value = "/param", method = POST)
    @ResponseBody
    public JsonResult param(@RequestParam String userId) {
        return new JsonResult<>();
    }

    @ApiOperation(value = "获取用户（管理员）信息", notes = "随边说点啥", tags = {"用户模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "mobile", value = "手机号", required = true, paramType = "form"),
            @ApiImplicitParam(name = "password", value = "密码", required = true, paramType = "form"),
            @ApiImplicitParam(name = "age", value = "年龄", required = true, paramType = "form", dataType = "Integer")
    })
    @RequestMapping(value = "/loginInfo", method = POST)
    @ResponseBody
    public JsonResult<Admin> login(@RequestParam String mobile, @RequestParam String password,
                                   @RequestParam Integer age) {
        try {
            List<Admin> list = adminService.getAdmins();
            JsonResult result = new JsonResult(list);
            return result;
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult<>();
        }
//        return "登录获取用户信息啦";
    }

    //MARK:根据用户id查找单个用户信息
    @ApiOperation(value = "根据id查询对应用户", tags = {"用户模块"})
    @RequestMapping(value = "/{id}", method = POST)
    @ResponseBody
    public JsonResult<User> findUserById(@PathVariable Integer id) {
        try {
            User user = userService.queryById(id);
            return new JsonResult(user);
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult<>();
        }
    }

    //MARK:-订单
    @ApiOperation(
            value = "获取订单列表",
            notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
            response = Order.class,
            tags = {"订单模块"})
    @RequestMapping(value = "/orders", method = POST)

    @ResponseBody
    public JsonResult<Order> getOrders() {
        try {
            List<Order> list = orderService.queryAllOrders();
            return new JsonResult(list);
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }
    }

    //MARK:-查询订单信息
    @ApiOperation(
            value = "根据id获取订单信息",
            notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
            response = Order.class,
            tags = {"订单模块"})
    @RequestMapping(value = "/order/{id}", method = POST)
    @ResponseBody
    public JsonResult<Order> getOrderById(@PathVariable("id") Integer id) {
        try {
            Order order = orderService.queryOrderById(id);
            return new JsonResult<>(order);
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }
    }

    //MARK:-添加订单
    @ApiOperation(value = "添加订单", tags = {"订单模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单Id", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "orderId", value = "订单编号", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "orderName", value = "订单名称", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "price", value = "订单价格", required = true, paramType = "form", dataType = "float"),
            @ApiImplicitParam(name = "content", value = "订单信息", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "createTime", value = "生产日期", required = true, paramType = "form", dataType = "Date"),
            @ApiImplicitParam(name = "updateTime", value = "更新日期", required = true, paramType = "form", dataType = "Date")
    })
    @RequestMapping(value = "/addOrder", method = POST)
    @ResponseBody
    public JsonResult addUser(Order order) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(formatter.format(order.getCreateTime()));

        order.setId(order.getId());
        order.setOrderId(order.getOrderId());
        order.setOrderName(order.getOrderName());
        order.setPrice(order.getPrice());
        order.setContent(order.getContent());
        order.setCreateTime(order.getCreateTime());
        order.setUpdateTime(order.getUpdateTime());
        order.setOrderNo(order.getOrderNo());
        try {
            orderService.insertOrder(order);
            return new JsonResult();

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }

    }

    //MARK:-修改订单
    @ApiOperation(value = "修改订单", tags = {"订单模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "订单Id", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "orderId", value = "订单编号", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "orderName", value = "订单名称", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "price", value = "订单价格", required = true, paramType = "form", dataType = "float"),
            @ApiImplicitParam(name = "content", value = "订单信息", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "createTime", value = "生产日期", required = true, paramType = "form", dataType = "Date"),
            @ApiImplicitParam(name = "updateTime", value = "更新日期", required = true, paramType = "form", dataType = "Date")
    })
    @RequestMapping(value = "/updateOrder", method = POST)
    @ResponseBody
    public JsonResult updateUser(Order order) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(formatter.format(order.getCreateTime()));

        order.setId(order.getId());
        order.setOrderId(order.getOrderId());
        order.setOrderName(order.getOrderName());
        order.setPrice(order.getPrice());
        order.setContent(order.getContent());
        order.setCreateTime(order.getCreateTime());
        order.setUpdateTime(order.getUpdateTime());
        order.setOrderNo(order.getOrderNo());
        try {

            orderService.updateOrder(order);
            return new JsonResult();

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }

    }

    //MARK:-删除订单
    @ApiOperation(
            value = "根据id删除订单",
            notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
            response = Order.class,
            tags = {"订单模块"})
    @RequestMapping(value = "/delOrder/{orderId}", method = POST)

    @ResponseBody
    public JsonResult deleteOrderById(@PathVariable("orderId") Integer orderId) {
        try {
            orderService.deleteUserById(orderId);
            return new JsonResult();

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }
    }

    //MARK:-根据用户名查找单个用户信息 Ambiguous handler methods mapped for '/user/lucy' ，
    // 字面含义，模棱两可的处理方法对于'/user/lucy' ，有两个或以上的方法对于'/user/lucy'，
    // 这里说明，spring无法根据传参的类型自动匹配处理的方法。
    @ApiOperation(value = "根据用户名查找单个用户信息", tags = {"用户模块"})
    @RequestMapping(value = "/findUser/{name}", method = POST)
    @ResponseBody
    public JsonResult<User> find(@PathVariable String name) {

        try {
            List<User> users = userService.find(name);
            return new JsonResult(users);

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult<>();
        }
    }

    //MARK:-根据id添加用户
    @ApiOperation(value = "添加用户", tags = {"用户模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户Id", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "form"),
            @ApiImplicitParam(name = "pwd", value = "密码", required = true, paramType = "form"),
            @ApiImplicitParam(name = "age", value = "年龄", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "balance", value = "存款", required = true, paramType = "form", dataType = "Float"),
            @ApiImplicitParam(name = "regTime", value = "注册日期", required = true, paramType = "form", dataType = "Date")
    })
    @RequestMapping(value = "/addUser", method = POST)
    @ResponseBody
    public JsonResult addUser(User user) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(formatter.format(user.getRegTime()));

        try {
            userService.addUser(user.getId(), user.getUsername(), user.getAge(), user.isSex(), user.getBalance(), formatter.format(user.getRegTime()), user.getPwd());
            return new JsonResult();
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }

    }

    //MARK:-删除
    @ApiOperation(value = "根据id删除（单个）用户", tags = {"用户模块"})
    @RequestMapping(value = "/del/{userId}", method = POST)
    @ResponseBody
    public JsonResult deleteUser(@PathVariable("userId") Integer id) {
        try {
            userService.deleteUserById(id);
            return new JsonResult();
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    //MARK:-修改
//    @ApiOperation(value="根据id修改user model",tags = { "增删查改模块" })
//    @PutMapping(value="/modify")
//    @ResponseBody//返回json字段给前端，否则报错
//    public String modify(@RequestBody User user) {//返回字段为text
//        userService.updateUser(user.getId(),user.getUsername(),user.getAge(),user.isSex(),user.getBalance(),user.getRegTime(),user.getPwd());
//        return "user 修改成功！";
//    }

    //MARK:-更新用户信息
    @ApiOperation(value = "updateUser测试", tags = {"用户模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户Id", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "username", value = "用户名", required = true, paramType = "form"),
            @ApiImplicitParam(name = "pwd", value = "密码", required = true, paramType = "form"),
            @ApiImplicitParam(name = "age", value = "年龄", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "balance", value = "存款", required = true, paramType = "form", dataType = "Float"),
            @ApiImplicitParam(name = "regTime", value = "注册日期", required = true, paramType = "form", dataType = "Date")
    })
    @RequestMapping(value = "/updateUser", method = POST)
    @ResponseBody
    public JsonResult updateUser(User user) {

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
        System.out.println(formatter.format(user.getRegTime()));

        try {
            userService.updateUser(user.getId(), user.getUsername(), user.getAge(), user.isSex(), user.getBalance(), formatter.format(user.getRegTime()), user.getPwd());
            return new JsonResult();
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    @ApiOperation(value = "获取用户书籍列表", notes = "", tags = {"书籍模块"})
    @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Integer")
    @RequestMapping(value = "/books", method = POST)
    @ResponseBody
    public JsonResult<BookEntity> getBooksList() throws Exception {
        try {
            List<BookEntity> list = bookService.getBooksList();
            return new JsonResult(list);

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }

    }

    //MARK:-添加书本
    @ApiOperation(value = "添加书本", tags = {"书籍模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户Id", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "name", value = "书名", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "isOnSale", value = "是否在售", required = true, paramType = "form", dataType = "boolean"),
            @ApiImplicitParam(name = "price", value = "价格", required = true, paramType = "form", dataType = "float"),
            @ApiImplicitParam(name = "publish_date", value = "发布日期", required = true, paramType = "form", dataType = "Date"),
            @ApiImplicitParam(name = "author_name", value = "作者", required = true, paramType = "form", dataType = "String")
    })
    @RequestMapping(value = "/addBook", method = POST)
    @ResponseBody
    public JsonResult addBook(BookEntity b) {

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

        b.setId(b.getId());
        b.setName(b.getName());
        b.setIsOnSale(false);
        b.setPrice(b.getPrice());
        b.setPublish_date(b.getPublish_date());
        b.setAuthor_name(b.getAuthor_name());
        try {
            bookService.insertBook(b);

            return new JsonResult();

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }
    }

    //MARK:-查找书籍
    @ApiOperation(value = "根据id查找（单个）书籍", tags = {"书籍模块"})
    @RequestMapping(value = "/findBook/{id}", method = POST)
    @ResponseBody
    public JsonResult<BookEntity> findBookById(@PathVariable("id") Integer id) {
        try {
            BookEntity book = bookService.findBookById(id);
            return new JsonResult(book);
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    //MARK:-修改书本
    @ApiOperation(value = "修改书本", tags = {"书籍模块"})
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "用户Id", required = true, paramType = "form", dataType = "Integer"),
            @ApiImplicitParam(name = "name", value = "书名", required = true, paramType = "form", dataType = "String"),
            @ApiImplicitParam(name = "isOnSale", value = "是否在售", required = true, paramType = "form", dataType = "boolean"),
            @ApiImplicitParam(name = "price", value = "价格", required = true, paramType = "form", dataType = "float"),
            @ApiImplicitParam(name = "publish_date", value = "发布日期", required = true, paramType = "form", dataType = "Date"),
            @ApiImplicitParam(name = "author_name", value = "作者", required = true, paramType = "form", dataType = "String")
    })
    @RequestMapping(value = "/updateBook", method = POST)
    @ResponseBody
    public JsonResult<String> updateBook(BookEntity b) {

        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");

        b.setId(b.getId());
        b.setName(b.getName());
        b.setIsOnSale(false);
        b.setPrice(b.getPrice());
        b.setPublish_date(b.getPublish_date());
        b.setAuthor_name(b.getAuthor_name());
        try {
            bookService.updateBookById(b);

            return new JsonResult("操作成功");

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);
        }
    }

    @ApiOperation(value = "说hello", notes = "", tags = {"用户模块"})
    @RequestMapping(value = "/hello", method = GET)
    @ResponseBody
    public JsonResult<String> sayHello() {
        return new JsonResult<>("hello");
    }

    @ApiOperation(value = "说sayHi", notes = "", tags = {"用户模块"})
    @RequestMapping(value = "/sayHi", method = GET)
    @ResponseBody
    public JsonResult<String> sayHi() {

        return new JsonResult<>("hi");
    }

    @ApiOperation(value = "获取用户列表", notes = "", tags = {"用户模块"})
    @RequestMapping(value = "/allUser", method = POST)
    @ResponseBody
    public JsonResult<User> list() {
        try {
            List<User> list = userService.queryAllUser();
            return new JsonResult(list);
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult<>();
        }
    }

    //MARK:-userHandle查询
    @ApiOperation(value = "userHandle查询测试", tags = {"用户模块"})
    @RequestMapping(value = "/all/userHandle", method = POST)
    @ResponseBody
    public JsonResult<t_userHandle> t_userHandle() {
        try {
            List<t_userHandle> list = t_userService.loadUsersByIdHandAlias();
            return new JsonResult(list);

        } catch (Exception e) {
            e.printStackTrace();
            return new JsonResult<>();
        }
    }

    /*
    生成唯一主键
    格式：时间+随机数
     */
    public static synchronized Integer genUniqueKey() {
        Random random = new Random();
        Integer number = random.nextInt(9000) + 1000;
        return number;
//        return System.currentTimeMillis() + String.valueOf(number);
    }

    //MARK:-注册用户
    @ApiOperation(value = "创建/注册用户", notes = "根据User对象创建用户", tags = {"用户模块"})
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
    @RequestMapping(value = "/register", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<String> postUser(User user) {

        Integer userId = genUniqueKey();

        user.setId(userId);
        if (user.getUsername() == null || user.getPwd() == null) {
            return new JsonResult<>("请输入用户名或密码");
        } else if (user.getPwd().length() >= 6 && user.getUsername().length() >= 2) {
            User isExistUser = userService.queryById(user.getId());
            if (isExistUser == null) {
                try {
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
                    userService.addUser(user.getId(), user.getUsername(), user.getAge(), user.isSex(), user.getBalance(), formatter.format(user.getRegTime()), user.getPwd());
                    return new JsonResult<>("注册成功！");

                } catch (Exception e) {
                    System.out.println(e);
                    return new JsonResult<>("注册失败！");
                }
            } else if (isExistUser != null) {
                return new JsonResult<>("该用户已经注册！");
            }
        }
        return new JsonResult<>("用户注册！");

    }
    @ApiOperation(value = "用户退出登录", notes = "根据UserId对象登录", tags = {"用户模块"})

    @RequestMapping(value = "loginOut", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<String> loginOut() {
        return new JsonResult("退出登录成功!");
    }

    @ApiOperation(value = "用户登录", notes = "根据UserId对象登录", tags = {"用户模块"})
    @ApiImplicitParam(name = "ApiRequestUserEntity", value = "用户详细实体ApiRequestUserEntity", required = true, dataType = "ApiRequestUserEntity")
    @RequestMapping(value = "login", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<User> loginUser(@RequestBody User user) {

        User u = new User();
        if (user.getUsername() == null || user.getPwd() == null) {
            return new JsonResult("请输入用户名或密码");
        } else {
            if (user.getPwd().length() >= 4 && user.getUsername().length() >= 2) {
                List<User> list = userService.findUserByUser(user.getUsername(), user.getPwd());
                if (list == null || list.size() == 0) {
                    return new JsonResult("用户不存在");
                }
                if (list.size() != 0) {
                    try {
                        u = list.get(0);
                        // 查询到的用户密码和用户名输入的密码不一致
                        if (!u.getPwd().equals(user.getPwd())) {
                            return new JsonResult("密码错误");
                        }else {
//                            return new JsonResult("登录成功");
                            return new JsonResult<>(u);
                        }
                    } catch (Exception e) {
                        System.out.println(e);
                        return new JsonResult(e);
                    }
                }
            }
        }
        return new JsonResult("请登录");
    }

    //MARK:-获取用户个人信息
    @ApiOperation(value = "获取用户个人信息", notes = "获取用户个人信息", tags = {"用户模块"})
    @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
    @RequestMapping(value = "/userInfo/{id}", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<User> getUser(@PathVariable Integer id) {
        User u = new User();

        try {
            User isExistUser = userService.queryById(id);
            if (isExistUser == null) {
                return new JsonResult("用户不存在");
            }
            if (isExistUser != null) {
                return new JsonResult(isExistUser);
            }
        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }

        return new JsonResult("查询用户信息");
    }

    //MARK:-获取部门信息
    @ApiOperation(value = "获取部门信息", notes = "获取部门信息", tags = {"部门模块"})
    @ApiImplicitParam(name = "department", value = "部门实体department", required = true, dataType = "Department")
    @RequestMapping(value = "/department", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<Department> getDepartments() {
        try {
            List<Department> list = departmentService.getDepartments();
            if (list != null) {
                return new JsonResult(list);
            }else {
                return new JsonResult<>();

            }

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    //MARK:-添加部门
    @ApiOperation(value = "添加部门", notes = "添加部门", tags = {"部门模块"})
    @ApiImplicitParam(name = "department", value = "部门实体department", required = true, dataType = "Department")
    @RequestMapping(value = "/addDepartment", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<String> addDepartments(Department department) {
        try {
            departmentService.addDepartment(department.getId(),department.getDepartmentName());

            return new JsonResult<>();

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    //MARK:-获取员工信息
    @ApiOperation(value = "获取员工信息", notes = "获取员工信息", tags = {"员工模块"})
    @ApiImplicitParam(name = "employee", value = "员工实体employee", required = true, dataType = "Employee")
    @RequestMapping(value = "/employee", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<Employee> getEmployees() {
        try {
            List<Employee> list = employeeService.getEmployees();
            if (list != null) {
                return new JsonResult(list);
            }else {
                return new JsonResult<>();

            }

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    //MARK:-添加员工
    @ApiOperation(value = "添加员工", notes = "添加员工", tags = {"员工模块"})
    @ApiImplicitParam(name = "employee", value = "员工实体employee", required = true, dataType = "employee")
    @RequestMapping(value = "/addEemployee", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<String> addEemployee(Employee employee) {
//        Employee employeeEntity = new Employee();
//        employee.setDepartment(departmentMapper);
        try {

            employeeService.addEmployee(employee.getId(),employee.getLastName(),employee.getEmail(),employee.getGender(),employee.getDepartment(),employee.getBirthday());

            return new JsonResult<>();

        } catch (Exception e) {
            System.out.println(e);
            return new JsonResult(e);

        }
    }

    @ApiOperation(value = "更改客户信息", notes = "添加客户", tags = {"客户模块"})
    @ApiImplicitParam(name = "ApiRequestEntiy", value = "客户实体ApiRequestEntiy", required = true, dataType = "ApiRequestEntiy")
    @RequestMapping(value = "/updateUserInfo", method = RequestMethod.POST)
    @ResponseBody
    public JsonResult<ApiRequestDataEntiy> showString(@RequestBody ApiRequestDataEntiy param){
        System.out.println(param.getData());
        return new JsonResult<>(param);
    }
}